<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>候选单位详细信息</title>
<%@ include file="/common/meta.jsp"%>
<script type="text/javascript" src="${res}/js/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript" src="${res}/js/validate/irisvalidator.js"></script>
<script type="text/javascript" src="${res}/js/autodisckey/autodisckey.js"></script>
<style type="text/css">
	.input_width { width:130px }
	.select_width { width:143px }
	.table_td td {border:0}
	.long_input{ width:642px }
    .selectWidth4{width:674px;}
</style>
<script type="text/javascript">
var type = "${param.type}";
var parentTable = parent.$("#"+"${param.parentTab}");	//父页面的表格
var selectRadio = $();									//父页面选中的单选框
var selectTr = $();										//父页面选中的行

if(type=="edit") {
	selectRadio = parentTable.find(":radio:checked");
	selectTr = selectRadio.parents("tr");
}

$(function(){
	$("#fragment-tab1 :text,#fragment-tab1 [type='date']").addClass("input_width");
	$("#fragment-tab1 select").addClass("select_width");
	if(type=="edit"){
		
		$("input:not(:radio:button),textarea").each(function(){

			var id=$(this).attr("name");
			if(id==null || id=="")
				return true;
			
			var parentObj=selectTr.find("[name$='/"+id+"']");
			var value="";
			if(parentObj.is("span"))
				value=parentObj.text();
			else
				value=parentObj.val();
			//if($(this).is("input"))//初始化input框 不包括radio
				$(this).val(value);
				if($(this).is("span")){
					$(this).text(value);
				}
		});
		
		tree();
		$(":radio").each(function(){//初始化radio框
			var name=$(this).attr("name");
		
			
			var value=$("[name='"+name+"_value']").val();
			if($(this).val()==value)
				$(this).attr("checked",true);
			
		});
		
		
	$("input:not(:button),textarea").each(function(){
		$(this).attr("disabled",true);
		$(this).attr("class","gray input_width");
	});
	$("select").each(function(){
		$(this).attr("disabled",true);
		$(this).attr("class","gray select_width");
	});
}
});	
function tree(){
	
	var prof_title_name=$("#prof_title_name").val(); 
	$("#prof_title").val(prof_title_name);
	var subject_name=$("#subject_name").val(); 
	$("#subject").val(subject_name);
	var discipline_name=$("#discipline_name").val(); 
	$("#discipline").val(discipline_name);
	
}
function loadAjaxSelect(selectId,url,params,varParm){
	var submitpsn=selectTr.find("[name$='submit_psn']");//标示是否是申报人
	var isAdminor=false;//根据权限判断是否是单位管理员
	<security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
	isAdminor = true;
	</security:authorize>
	$.ajax( {
		url : url,
		type : 'post',
		dataType:'json',
		data : params,
		success : function(data) {
			
			for(var i=0;i<data.length;i++){
				var value=data[i].id;
				var text=data[i].name;		
				$("#"+selectId).append("<option value='"+value+"'>"+text+"</option>");
				

			}
			if(type=="edit" && selectId != "card_type"){//如果是修改，才需要初始化select框的值
				var selectValue=$("[name='"+selectId+"_value']").val();
				$("#"+selectId+" option").each(function(i,obj){
					if($(obj).val()==selectValue){
						setTimeout(function() {
							$(obj).attr("selected",true);
						}, 1);
					}
				});
			}
			if(type=="edit" && selectId == "card_type"){ 
				if(submitpsn.length>0 && submitpsn.val()=="1" && isAdminor){
					$("#"+selectId+" option").each(function(i,obj){
						if($(obj).val()==1){
							setTimeout(function() {
								$(obj).attr("selected",true);
							}, 1);
						}
					});
					$("#"+selectId).attr("disabled",true);
				}else{
					var selectValue=$("[name='"+selectId+"_value']").val();
					$("#"+selectId+" option").each(function(i,obj){
						if($(obj).val()==selectValue){
							setTimeout(function() {
								$(obj).attr("selected",true);
							}, 1);
						}
					});
				}
			}
			
			//setDegree();	
		}
	});
	}


</script>
</head>
<body>

	<div id="tabnav">
		<ul>
			<li class="down" id="tab1" onclick="changeTab(this.id)">
					<a href="###"><span>候选单位信息</span></a>
			</li>
		</ul>
	</div>
	
	<div class="tab_box" id="fragment-tab1">
		<table class="t_css" width="100%" border="0" cellpadding="0" label="单位信息" cellspacing="1">
		<security:authorize ifAnyGranted="A_MENU_MANAGE_19">
		<input type="hidden" name="depart_code" id="depart_code"  value="" >
        </security:authorize>
		<col width="20%;"/>
		<col width="30%;"/>
		<col width="20%;"/>
		<col width="30%;"/>
		<tr>
			<td nowrap align="right">单位名称：</td>
			<td width="350px">
				<input name="org_name"  type="text"/>
			</td>
			<td align="right">
				所在地：
			</td>
			<td>
				<input type="text" name="org_place"/>
			</td>
		</tr>
		

		<tr>
			<td align="right">
				排名：
			</td>
			<td>
				<input type="text" name="rank" />
			</td>
			<td align="right">单位属性：</td>
			<td>
				<cpt:select id="nature"  key="unit_attribute" onChange="initControlValue(this.id);"></cpt:select>
				<input type="hidden" name="nature_value" value="" >
				<input type="hidden" name="nature_name" value="">
			</td>
		</tr>
		
		<tr>
			<td align="right">传真：</td>
			<td>
				<input type="text"  name="fax2" />
			</td>
			<td align="right">联系人：</td>
			<td>
				<input type="text" name="contact_name" />
			</td>
		</tr>
		<tr>
			<td align="right">
				联系电话：
			</td>
			<td>
				<input type="text" name="org_tel" />
			</td>
			<td align="right">移动电话：</td>
			<td>
				<input type="text" id="contact_mobile" name="contact_mobile"/>
			</td>
		</tr>
		
		<tr>
			<td align="right">通讯地址：</td>
			<td>
				<input type="text" name="address"/>
			</td>
			<td align="right">邮政编码：</td>
			<td>
				<input type="text" id="zip_code" name="zip_code" />
			</td>
		</tr>
		
		<tr>
			<td align="right">电子信箱：</td>
				<td>
					<input type="text" name="email" />
			</td>
			<td align="right">企业注册号或组织机构代码：</td>
				<td>
					<input type="text" name="enterprise_number" />
			</td>
		</tr>
		<tr>
      		<td align="right">对本项目技术创新和应用推广的贡献：</td>
     		<td colspan="3">
     			<textarea rows="9"  style="width:83%;" class="input_textarea required maxlength:300" name='contribution' ></textarea>
     		</td>
     	</tr>
	
	</table>
	</div>

	<table width="100%" align="center">
		<tr>
			<td>
				<input type="button" id="cancel" class="button_01 notdisabled" value="关闭" onclick="parent.tb_remove();">
			</td>
		</tr>
	</table>
	<br/>
</body>
</html>

